<?php

//$name=$_GET['name'];
$name='2012-07-22';
$db_name='test';
$tools='C:/wamp/bin/mysql/mysql5.5.8/bin/mysql';

$target='C:/wamp/www/ivyproject/Public/backup/'.$name.'/'.$name.'.sql';

//备份数据库时已经考虑到要删除数据库后再导入，故而不需要在这里先进行删除了
$command=$tools.' '.$db_name.' < '.$target;
exec($command); 

//将文件夹恢复
include("deldir.php");
include("dir.php");

$from='C:/wamp/www/ivyproject/Public/backup/'.$name.'/'.$name;
$to='C:/wamp/www/ivyproject/Public/uploads';
$file1=new deldir($to);
$file=new copyFile($from, $to);


echo '您的数据库和上传文件夹已经恢复至'.$name;
echo ' <script type="text/javascript">
  
function CloseWindow(action) {

        if (window.CloseOwnerWindow) window.CloseOwnerWindow(action);

        else window.close();

    	} 
		
  </script>';
?>